package com.example.test.springdemo.controller;

import com.example.test.springdemo.common.Result;
import com.example.test.springdemo.domain.AdminUserRole;
import com.example.test.springdemo.domain.UserRole;
import com.example.test.springdemo.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：吉金武
 * @ClassName UserRoleController
 * @date ：2022/3/9 - 22:12
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 * @description:
 * 用户，角色关联类
 **/
@RestController
@RequestMapping("/userRole")
public class UserRoleController {

    @Autowired
    private UserRoleService userRoleService;

    /**
     * 分配角色
     * @return
     */
    @PostMapping("/insertUserRole")
    public Result insertUserRole(UserRole userRole){
        System.out.println(userRole.toString());
        userRoleService.insertUserRole(userRole.getUserId(),userRole.getRoleId());
        return Result.success("分配成功");
    }
}

